<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<title>
		Javascript Audio Processing
	</title>
	<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js?autoload=true&amp;skin=sunburst&amp;lang=css" defer="defer"></script>
	<!-- show all line numbers-->
	<style type="text/css">
		body {
			font-family:Arial, Helvetica, sans-serif;
		}
		.prettyprint ol.linenums>li {
			list-style-type: decimal
		}
	</style>
	<script src="../build/maximilian.js"></script>
</head>

<body>
	<h1> Maximilian.js Examples </h1>
	<p></p>
	<ul>
		<li>maxiSVF Demo</li>
	</ul>
	<button id="playButton">Play</button>
	<!-- <pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" > -->
	</pre>
</body>

<!-- Our javascript code -->
<script type="text/javascript">

	let maxi = maximilian();

	var maxiEngine = new maxi.maxiAudio();

	let playAudio = () => {

		maxiEngine.init(0);

		var osc1=new maxi.maxiOsc();
		var osc2=new maxi.maxiOsc();
		var osc3=new maxi.maxiOsc();
		var svf=new maxi.maxiSVF();

		maxiEngine.play = function(input) {
			var mix=0;
			svf.setCutoff(40 + Math.abs(osc3.sinewave(0.5) * 500.0));
	    svf.setResonance(osc2.phasor(0.2) * 1.2);
	    mix = svf.play(osc1.saw(100), 1, 0, 0, 0);
			return mix;
		}
	}

	const playButton = document.getElementById('playButton');
	playButton.addEventListener("click", () => playAudio());

</script>

</html>
